/*
 * @Author: fhw
 * @Date: 2021-11-12 10:16:13
 * @Description:
 */
import { createApp } from 'vue'
import App from './App'
import router from './router'
import store from './store'
import 'ant-design-vue/dist/antd.css'
import '@/styles/index.scss' // global css
import Antd from 'ant-design-vue'
import SocketIO from '@/utils/socket.io'
import '@/api'
import Directive from '@/plugins/directive'
import 'default-passive-events'
if (typeof (window as any).global === 'undefined') {
	;(window as any).global = window
}
const socketOptions = {
	autoConnect: true, // 自动连接
	transports: ['websocket'], // 指定为websocket连接
	reconnect: true,
	reconnectionAttempts: 5, // 重连次数
}
/** 编辑器 */
import VMdEditor from '@kangc/v-md-editor'
import '@kangc/v-md-editor/lib/style/base-editor.css'
import githubTheme from '@kangc/v-md-editor/lib/theme/github.js'

import '@kangc/v-md-editor/lib/theme/style/github.css'
import createCopyCodePlugin from '@kangc/v-md-editor/lib/plugins/copy-code/index'
import '@kangc/v-md-editor/lib/plugins/copy-code/copy-code.css'
import VMdPreview from '@kangc/v-md-editor/lib/preview'
import '@kangc/v-md-editor/lib/style/preview.css'
/** 编辑器样式 */
import hljs from 'highlight.js'
import 'highlight.js/styles/stackoverflow-light.css' // 可以切换其它样式风格，例如黑色主题
import 'highlight.js/lib/common'
import hljsVuePlugin from '@highlightjs/vue-plugin'
VMdEditor.use(githubTheme, {
	Hljs: hljs,
}).use(createCopyCodePlugin())

VMdPreview.use(githubTheme, {
	Hljs: hljs,
}).use(createCopyCodePlugin())

import FTable from '@/components/FTable/index'
const app = createApp(App)
app.use(SocketIO, {
	connection: 'ws://localhost:3002',
	options: socketOptions,
})
app
	.use(store)
	.use(FTable)
	.use(router)
	.use(Antd)
	.use(Directive)
	.use(VMdEditor)
	.use(VMdPreview)
	.use(hljsVuePlugin)
	.mount('#app')
